<?php
/**
 Template Name:avertising
 */
 $siteurl = get_bloginfo('template_url');
 $blog_title = get_bloginfo('name');
 
 get_header(); 
 //用户输入数据存入数据库表_avertising
 
 $name = $_POST['ming'];
 $qq = $_POST['QQ'];
 $email = $_POST['email'];
 $content = $_POST['content'];
 $yz = $_POST['yz'];
 $session = $_SESSION["verify_py"]["code"];
 $yz = strtoupper($yz);
 	
 	if($yz !==null && $yz !==""){
		if($yz == $session){
			$insertsql = "insert into avertising(name,QQ,content,emaile)values('$name',$qq,'$content','$email')";
			  if($email !== null && $email !=="" && $content !==null && $content !== ""){
				 mysql_query($insertsql);
			 }
			if($email !== null && $email !=="" && $content !==null && $content !== ""){
		 		add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
				$headers = 'From: 游戏搜搜 <noreply@youxisoso.com>' . "\r\n";
				$messsage = "Hi：<br/><br/>";
				$messsage .= "又有一个客户提交了广告申请<br/>";
				$messsage .="用户名字：".$name."<br/>";
				$messsage .= "用户QQ为： ".$qq."<br/>";
				$messsage .= "用户邮箱为： ".$email."<br/>";
				$messsage .= "用户推广目标和内容： ".$content."<br/>";
				
				wp_mail('yuguangyang0407@163.com,superyuyue@126.com,21850845@qq.com,feiya123@gmail.com,youxisoso@foxmail.com', 'youxisoso.com一个新客户提交了广告信息', $messsage, $headers);
	 		}
		}else{
			 echo '<script type="text/javascript">';
			 echo 'alert("抱歉，验证码错误请重新输入！")';
			 echo "</script>";
		} 
 	}
 
?>
  <div id="content">
        <div id="avertising">
            <p><strong>游戏搜搜(YouXiSoSo.com)</strong> 相当注重用户体验，同时兼顾广告商的利益，并给用户带来的增值内容。本站目前主要接受游戏类广告商的广告投放。<br /><br />我们的广告形式有很多种。如果您作为广告商对在youxisoso.com投放广告有兴趣，请随时联系我们。我们将跟您商量最好的广告解决方案.</p>
            <div id="aver_lian_form">
                 <form action="" method="post" >
                 	<input type="hidden" name="page_id" value="118343"/>
                    <label for="name">名字:</label><br />
                    <input type="text" id="name" name="ming" class="formborder bubian"  onfocus="this.className='bianse bubian'" onblur="this.className='formborder bubian'"/>
<br />
                    <label for="email">Email:</label><br />
                    <input type="text" id="email" name="email" class="formborder bubian"  onfocus="this.className='bianse bubian'" onblur="this.className='formborder bubian'" /><br />
                    <label for="QQ">QQ:</label><br />
                    <input type="text" id="QQ" name="QQ" class="formborder bubian"  onfocus="this.className='bianse bubian'" onblur="this.className='formborder bubian'" /><br />
                    <label for="tuitext">推广目标和内容:</label><br />
                    <textarea id="tuitext" class="tuitext" name="content" onfocus="this.className='textbianse'" onblur="this.className='tuitext'"></textarea>
                    <label for="yanzheng">请输入验证码:&nbsp;&nbsp;&nbsp;&nbsp;</label>
                   	<input type="text" id="yanzheng" name="yz" class="formborder yanzheng"  onfocus="this.className='bianse yanzheng'" onblur="this.className='formborder yanzheng'" />
                    <img src="<?php echo $siteurl ?>/verify.php"  onclick="this.src='<?php echo $siteurl ?>/verify.php/'+Math.random()*5;" style="cursor:pointer" alt="验证码,看不清楚?请点击刷新验证码" title="验证码,看不清楚?请点击刷新验证码" id="checkCode" class="code" />
                    <input type="submit" value="" id="tijiao" />
                 </form>
            </div>
        </div>
	<?php get_footer();?>
